package com.avcompris.collections;

import java.io.Serializable;
import java.util.Map;

/**
 * a {@link Map} with mutable integer values.
 * The <tt>&lt;T&gt;</tt> parameterized type indicates the type of the map keys.
 */
public interface IntegerMap<T> extends Map<T, Integer>, Serializable {

	/**
	 * return a given integer in the map, creating it
	 * if necessary.
	 * 
	 * @return the value, never <tt>null</tt>.
	 */
	int getInt(T key);

	/**
	 * increment a given integer in the map, creating it (and incremeting it)
	 * if necessary.
	 * 
	 * @return the incremented value.
	 */
	int inc(T key);

	/**
	 * decrement a given integer in the map, creating it (and decremeting it)
	 * if necessary.
	 * 
	 * @return the decremented value.
	 */
	int dec(T key);

	/**
	 * increment a given integer in the map, creating it (and incremeting it)
	 * if necessary.
	 * 
	 * @return the incremented value.
	 */
	int inc(T key, int increment);

	/**
	 * decrement a given integer in the map, creating it (and decremeting it)
	 * if necessary.
	 * 
	 * @return the decremented value.
	 */
	int dec(T key, int decrement);
}
